use tsp::population::Population;

use tsp::*;

fn main() {
    let matches = init_matches();
    let get_val = |x| matches.value_of(x).unwrap();

    init_log(get_val("debug")).unwrap();

    let mut population = Population::new(
        read_map(get_val("data")).unwrap(),
        get_val("pn").parse::<u32>().unwrap(),
        get_val("pm").parse::<f64>().unwrap(),
        get_val("pc").parse::<f64>().unwrap(),
    );

    let iter_times = get_val("times").parse::<u32>().unwrap();
    for i in 0..iter_times {
        let cur_best = population.iterator().unwrap();
        log::info!("{}: {:?} Distance = {}", i, cur_best, cur_best.fitness());
    }
    println!("{}", population.iterator().unwrap().fitness());
}
